<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>期末设计--自动遮阳板 | 从代码到实物三人组总结</title><meta name="keywords" content="期末"><meta name="author" content="司书铭"><meta name="copyright" content="司书铭"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="通过光敏电阻的设计测量太阳入射角，设计一个光照入射角测量仪，进而制作一个汽车自动遮阳板。通过这个项目加强对3D打印、激光切割、硬件开发的学习">
<meta property="og:type" content="article">
<meta property="og:title" content="期末设计--自动遮阳板">
<meta property="og:url" content="http://example.com/2021/12/11/%E6%9C%9F%E6%9C%AB%E4%BD%9C%E4%B8%9A%E8%AE%BE%E8%AE%A1/index.html">
<meta property="og:site_name" content="从代码到实物三人组总结">
<meta property="og:description" content="通过光敏电阻的设计测量太阳入射角，设计一个光照入射角测量仪，进而制作一个汽车自动遮阳板。通过这个项目加强对3D打印、激光切割、硬件开发的学习">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/code2thing2021/picgo/raw/master/202112121023106.jpg">
<meta property="article:published_time" content="2021-12-11T04:55:17.000Z">
<meta property="article:modified_time" content="2021-12-12T02:10:45.032Z">
<meta property="article:author" content="司书铭">
<meta property="article:tag" content="期末">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/code2thing2021/picgo/raw/master/202112121023106.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2021/12/11/%E6%9C%9F%E6%9C%AB%E4%BD%9C%E4%B8%9A%E8%AE%BE%E8%AE%A1/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '期末设计--自动遮阳板',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-12-12 10:10:45'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="从代码到实物三人组总结" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://gitee.com/code2thing2021/picgo/raw/master/202112121023106.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">2</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">2</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-hear"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://s2.loli.net/2021/12/11/BoiwSXOe2CIhsN5.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">从代码到实物三人组总结</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-hear"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">期末设计--自动遮阳板</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-12-11T04:55:17.000Z" title="发表于 2021-12-11 12:55:17">2021-12-11</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-12-12T02:10:45.032Z" title="更新于 2021-12-12 10:10:45">2021-12-12</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/2021-02%E6%9C%9F%E4%BB%A3%E7%A0%81%E5%88%B0%E5%AE%9E%E7%89%A9/">2021-02期代码到实物</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="期末设计--自动遮阳板"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="自动遮阳板"><a href="#自动遮阳板" class="headerlink" title="自动遮阳板"></a>自动遮阳板</h1><h2 id="设计阶段"><a href="#设计阶段" class="headerlink" title="设计阶段"></a>设计阶段</h2><h3 id="线路连接"><a href="#线路连接" class="headerlink" title="线路连接"></a>线路连接</h3><img src="https://gitee.com/code2thing2021/picgo/raw/master/202112121008675.png" style="zoom:50%;" />

<p><img src="https://gitee.com/code2thing2021/picgo/raw/master/202112121008677.png"></p>
<img src="https://gitee.com/code2thing2021/picgo/raw/master/202112121008676.png" style="zoom:67%;" />

<h2 id="附录"><a href="#附录" class="headerlink" title="附录"></a>附录</h2><h3 id="硬件模块代码"><a href="#硬件模块代码" class="headerlink" title="硬件模块代码"></a>硬件模块代码</h3><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;Servo.h&gt;</span></span></span><br><span class="line">Servo s;</span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">setup</span><span class="params">()</span> </span>&#123;</span><br><span class="line">  <span class="comment">// put your setup code here, to run once:</span></span><br><span class="line">  Serial.<span class="built_in">begin</span>(<span class="number">9600</span>);</span><br><span class="line">  s.<span class="built_in">attach</span>(<span class="number">9</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">double</span> i,j,angle;</span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">loop</span><span class="params">()</span> </span>&#123;</span><br><span class="line">  <span class="comment">// put your main code here, to run repeatedly:</span></span><br><span class="line">  i=<span class="built_in">analogRead</span>(A0);</span><br><span class="line">  j=<span class="built_in">analogRead</span>(A1);</span><br><span class="line">  Serial.<span class="built_in">println</span>(<span class="string">&quot;i:&quot;</span>);</span><br><span class="line">  Serial.<span class="built_in">println</span>(i);</span><br><span class="line">  Serial.<span class="built_in">println</span>(<span class="string">&quot;j:&quot;</span>);</span><br><span class="line">  Serial.<span class="built_in">println</span>(j);</span><br><span class="line">  <span class="built_in">delay</span>(<span class="number">500</span>);</span><br><span class="line">  angle=<span class="built_in">atan</span>(j/i)*<span class="number">180</span>/<span class="number">3.1415926</span>;</span><br><span class="line">  angle=<span class="number">9</span>/<span class="number">4</span>*angle<span class="number">-54</span>;</span><br><span class="line">  <span class="keyword">if</span>(angle&lt;=<span class="number">44</span>)&#123;</span><br><span class="line">    s.<span class="built_in">write</span>(<span class="number">90</span>-angle<span class="number">-20</span>);</span><br><span class="line">    &#125;</span><br><span class="line">   <span class="keyword">else</span>&#123;</span><br><span class="line">    s.<span class="built_in">write</span>(<span class="number">0</span>); </span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<h3 id="串口编程"><a href="#串口编程" class="headerlink" title="串口编程"></a>串口编程</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> vpython <span class="keyword">import</span> *</span><br><span class="line"><span class="keyword">import</span> math</span><br><span class="line"><span class="keyword">from</span> time <span class="keyword">import</span> sleep</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="comment">## 初始化各个模块</span></span><br><span class="line">scene=canvas(width=<span class="number">800</span>,height=<span class="number">200</span>,center=vector(<span class="number">10</span>,<span class="number">0</span>,<span class="number">0</span>),background=color.cyan)</span><br><span class="line">box=box(pos=vector(<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>),size=vector(<span class="number">10</span>,<span class="number">10</span>,<span class="number">10</span>))</span><br><span class="line"></span><br><span class="line">l=<span class="number">20</span></span><br><span class="line">arrowlist0 = []</span><br><span class="line">arrowlist1 = []</span><br><span class="line">theta=<span class="number">0</span></span><br><span class="line"><span class="comment"># 上平面</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(-<span class="number">4</span>, <span class="number">4</span>, <span class="number">2</span>):</span><br><span class="line">    <span class="keyword">for</span> j <span class="keyword">in</span> <span class="built_in">range</span>(-<span class="number">4</span>, <span class="number">4</span>, <span class="number">2</span>):</span><br><span class="line">        arrowlist0.append(arrow(pos=vector(i + l * math.cos(theta), <span class="number">6</span> + l * math.sin(theta), j),</span><br><span class="line">                               axis=vector(-l * math.cos(theta), -l * math.sin(theta), <span class="number">0</span>), shaftwidth=<span class="number">0.1</span>,</span><br><span class="line">                               color=vector(<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>)))</span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(-<span class="number">4</span>, <span class="number">4</span>, <span class="number">2</span>):</span><br><span class="line">    <span class="keyword">for</span> j <span class="keyword">in</span> <span class="built_in">range</span>(-<span class="number">4</span>, <span class="number">4</span>, <span class="number">2</span>):</span><br><span class="line">        arrowlist1.append(arrow(pos=vector(<span class="number">6</span> + l * math.cos(theta), i + l * math.sin(theta), j),</span><br><span class="line">                               axis=vector(-l * math.cos(theta), -l * math.sin(theta), <span class="number">0</span>), shaftwidth=<span class="number">0.1</span>,</span><br><span class="line">                               color=vector(<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>)))</span><br><span class="line"><span class="comment">#设置背景</span></span><br><span class="line">gd=graph(title=<span class="string">&quot;角度变化图&quot;</span>,width=<span class="number">600</span>,height=<span class="number">400</span>,xtitle=<span class="string">&quot;时间&quot;</span>,ytitle=<span class="string">&quot;角度&quot;</span>)</span><br><span class="line"><span class="comment">#创建角度-时间曲线显示窗口</span></span><br><span class="line">xt=gcurve(graph=gd,color=color.red)</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">myplot</span>(<span class="params">theta</span>):</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> arrowlist0:</span><br><span class="line">        i.pos.x = + l * math.cos(theta)</span><br><span class="line">        i.pos.y = <span class="number">6</span> + l * math.sin(theta)</span><br><span class="line">        i.axis = vector(-l * math.cos(theta), -l * math.sin(theta), <span class="number">0</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> j <span class="keyword">in</span> arrowlist1:</span><br><span class="line">        j.pos.x = <span class="number">6</span> + l * math.cos(theta)</span><br><span class="line">        j.pos.y = l * math.sin(theta)</span><br><span class="line">        j.axis = vector(-l * math.cos(theta), -l * math.sin(theta), <span class="number">0</span>)</span><br><span class="line"><span class="keyword">import</span> serial</span><br><span class="line"><span class="keyword">import</span> re</span><br><span class="line"><span class="keyword">import</span> math</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">ReceiveSerial</span>(<span class="params">mySerial</span>):</span></span><br><span class="line">    <span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line">        data=<span class="built_in">str</span>(serial.read_all())</span><br><span class="line">        <span class="keyword">if</span> data==<span class="string">&quot;&quot;</span>:</span><br><span class="line">            <span class="keyword">continue</span></span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            <span class="keyword">break</span></span><br><span class="line">        sleep(<span class="number">0.02</span>)</span><br><span class="line">    <span class="keyword">return</span> data</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__==<span class="string">&quot;__main__&quot;</span>:</span><br><span class="line">    serial = serial.Serial(<span class="string">&#x27;COM7&#x27;</span>, <span class="number">9600</span>, timeout=<span class="number">0.5</span>)</span><br><span class="line">    <span class="keyword">if</span> (serial.isOpen()):</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;open success!&quot;</span>)</span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;openfailed!&quot;</span>)</span><br><span class="line">    start_time=time.time()</span><br><span class="line">    <span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line">        data = ReceiveSerial(serial)</span><br><span class="line">        <span class="keyword">if</span> data != <span class="string">&quot;b&#x27;&#x27;&quot;</span>:</span><br><span class="line">            pattern = re.<span class="built_in">compile</span>(<span class="string">r&quot;\d+.\d+&quot;</span>)</span><br><span class="line">            listdata = pattern.findall(data)</span><br><span class="line">            <span class="keyword">if</span> <span class="built_in">len</span>(listdata) == <span class="number">2</span>:</span><br><span class="line">                <span class="built_in">print</span>(<span class="string">&quot;i= &quot;</span> + listdata[<span class="number">0</span>] + <span class="string">&quot; j= &quot;</span> + listdata[<span class="number">1</span>])</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">                <span class="comment">#规划后的角度角度制</span></span><br><span class="line">                angle=<span class="number">9</span> / <span class="number">4</span> * math.degrees(math.atan((<span class="built_in">float</span>(listdata[<span class="number">1</span>])) / <span class="built_in">float</span>(listdata[<span class="number">0</span>]))) - <span class="number">54</span></span><br><span class="line">                <span class="built_in">print</span>(angle)</span><br><span class="line">                <span class="comment">#规划后的角度弧度制</span></span><br><span class="line">                rad=math.radians(angle)</span><br><span class="line">                <span class="built_in">print</span>(rad)</span><br><span class="line">                <span class="built_in">print</span>(<span class="string">&quot;***********&quot;</span>)</span><br><span class="line">                myplot(rad)</span><br><span class="line">                xt.plot(time.time()-start_time,angle)</span><br><span class="line">            <span class="keyword">else</span>:</span><br><span class="line">                <span class="keyword">continue</span></span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            <span class="keyword">continue</span></span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">sishu</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2021/12/11/%E6%9C%9F%E6%9C%AB%E4%BD%9C%E4%B8%9A%E8%AE%BE%E8%AE%A1/">http://example.com/2021/12/11/%E6%9C%9F%E6%9C%AB%E4%BD%9C%E4%B8%9A%E8%AE%BE%E8%AE%A1/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">从代码到实物三人组总结</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%9C%9F%E6%9C%AB/">期末</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/code2thing2021/picgo/raw/master/202112121023106.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="next-post pull-full"><a href="/2021/11/17/%E6%9C%9F%E4%B8%AD%E4%BD%9C%E4%B8%9A%E8%AE%BE%E8%AE%A1/"><img class="next-cover" src="https://gitee.com/code2thing2021/picgo/raw/master/202112121023106.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">期中设计--超声波测距仪</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%87%AA%E5%8A%A8%E9%81%AE%E9%98%B3%E6%9D%BF"><span class="toc-number">1.</span> <span class="toc-text">自动遮阳板</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BE%E8%AE%A1%E9%98%B6%E6%AE%B5"><span class="toc-number">1.1.</span> <span class="toc-text">设计阶段</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%BA%BF%E8%B7%AF%E8%BF%9E%E6%8E%A5"><span class="toc-number">1.1.1.</span> <span class="toc-text">线路连接</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%99%84%E5%BD%95"><span class="toc-number">1.2.</span> <span class="toc-text">附录</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%A1%AC%E4%BB%B6%E6%A8%A1%E5%9D%97%E4%BB%A3%E7%A0%81"><span class="toc-number">1.2.1.</span> <span class="toc-text">硬件模块代码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%B2%E5%8F%A3%E7%BC%96%E7%A8%8B"><span class="toc-number">1.2.2.</span> <span class="toc-text">串口编程</span></a></li></ol></li></ol></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 司书铭</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>